﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace DAL.Engine.Interface
{
    /// <summary>
    /// Take, update, delete entity's.
    /// </summary>
    /// <typeparam name="TEntity">The type contained in the repository.</typeparam>
    /// <typeparam name="TKey">The type used for the entity Id.</typeparam>
    public interface IRepository<TEntity, TKey>
        where TEntity : IEntity<TKey>
    {
        /// <summary>
        /// Returns the entity by id.
        /// </summary>
        /// <param name="id">The value representing some id of the entity.</param>
        /// <returns>The Entity</returns>
        TEntity Get(TKey id);

        /// <summary>
        /// Gets the all entities.
        /// </summary>
        /// <returns>The entities collection.</returns>
        IEnumerable<TEntity> GetAll();

        /// <summary>
        /// Add the new entity or update exisiting in the repository.
        /// </summary>
        /// <param name="entity">>The entity.</param>
        void Save(TEntity entity);

        /// <summary>
        /// Deletes an entity from the repository.
        /// </summary>
        /// <param name="entity">The entity to delete.</param>
        void Delete(TKey id);
    }
}
